<template>
  <view class="cm-switch" 
    :class="[cmClass, label === '' ? 'cm-switch-inline' : '']"
    :style="[cmStyle]">
    
    <view class="cm-switch-label" v-if="label !== ''">
      <view class="cm-padding-10 cm-flex-s-0" :style="[labelStyle]">{{ label }}</view>
      <view class="cm-padding-8">
        <switch :checked="checked" :disabled="disabled" :color="switchColor" @change="changeHandler" @click="clickHandler"></switch>
      </view>
    </view>
    
    <switch v-else :checked="checked" :disabled="disabled" :color="switchColor" @change="changeHandler" @click="clickHandler"></switch>
    
  </view>
</template>

<script src="./cm-switch.js"></script>

<style lang="stylus">
@import './cm-switch.styl'
</style>
